#include<stdio.h>
int isleapyear(int year)
{
    if (year%400==0){
        return 1;
    }
    if (year%4==0)
    {
        if (year%100!=0)
        {
            return 1;
        }
        else{
            return 0;
        }
    }
    else{
        return 0;
    }
}
int main(){
    int x,y;
    int sum=0; 
    int year[1000]={};
    scanf("%d%d",&x,&y);
    for(int i=x;i<=y;i++){
        if(isleapyear(i)){
            sum++;
            year[sum]=i;
        }
    }
    printf("%d\n",sum);
    for(int i=1;i<=sum;i++){
        printf("%d ",year[i]);
    }
}